package home

import (
	"fmt"
	"gin_hello/models"
	"gin_hello/util"
	"github.com/gin-gonic/gin"
	"net/http"
)

func Index(c *gin.Context) {
	c.JSON(
		http.StatusOK, gin.H{
			"code":    0,
			"message": "ok",
		},
	)
}

// GetData 获取db数据
func GetData(c *gin.Context) {
	s := util.GetLocalMysql(util.Hello)
	var authModel []*models.SpecialAuthGroups
	err := s.Model(&authModel).Find(&authModel).Error
	if err != nil {
		fmt.Println(err)
	}

	c.JSON(http.StatusOK, gin.H{
		"data": authModel,
	})
}
